package com.mlz.mlzmall.ui.dialog;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.mlz.mlzmall.R;

/**
 * describe :
 * Created by Pm on 2016/5/27.
 * PackageName com.mlz.mlzmall.ui.dialog.
 * ProjectName mlzmall_android.
 */

public class CollectionPopupWindow {
    public static View pw;
    public static PopupWindow pWindow;
    public static TextView tv_content;
    public static TextView tv_determine;
    public static void stateCollection(Context context,String str)
    {
        pw = LayoutInflater.from(context).inflate(R.layout.popupwindow_state_collection, null);
        tv_content=(TextView)pw.findViewById(R.id.tv_content);
        tv_determine=(TextView)pw.findViewById(R.id.tv_determine);
        tv_content.setText(str);
        tv_determine.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pWindow.dismiss();
            }
        });
        pWindow = new PopupWindow(pw, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);//弹框显示大小
        pWindow.setFocusable(true);
        pWindow.setOutsideTouchable(true);

        pWindow.setBackgroundDrawable(new ColorDrawable(0x55000000));//设置背景为透明
        //      pWindow.setAnimationStyle(R.style.AnimationBottom);
        pWindow.showAtLocation(pw, Gravity.CENTER, 0, 0);
    }
}
